
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Archive</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/handlebars.min.js" type="text/javascript"></script>
<script src="libs/getQueryString.js" type="text/javascript"></script>
 <script src="libs/jquery.backstretch.min.js"></script>
</head>

<body>
	<div class="container">
		<div class="row">
			<div class="page-header">
				<h1 align="center">
					<strong>Archive</strong>
					</h2>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-8">
				<ul class="nav nav-pills">
					<li><a href="index.html">首页</a></li>
					<li><a href="add.html">档案添加</a></li>
					<li><a href="querymohu.html">查询</a></li>
					<li><a href="#"><span id="nickname">用户</span></a></li>
				</ul>

			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<hr />
			</div>
		</div>
	</div>
	<div class="container">
		<!-- Nav tabs -->
		<ul class="nav nav-tabs" role="tablist">
			<li role="presentation" class="active"><a href="#home"
				aria-controls="home" role="tab" data-toggle="tab">档案详情</a></li>
			<li role="presentation"><a href="#profile"
				aria-controls="profile" role="tab" data-toggle="tab">文件总览</a></li>
			<li role="presentation"><a href="#messages"
				aria-controls="messages" role="tab" data-toggle="tab">上传文件</a></li>
		</ul>

		<!-- Tab panes -->
		<div class="tab-content">
			<div role="tabpanel" class="tab-pane active" id="home">
				<div class="panel-body" id="list1">
					<div class="container">
						<h3 align="center">
							<div class="row">
								<div class="col-md-6 col-md-offset-3">
									<table border="2px">

										<tr>
											<td><strong>档案号：</strong></td>
											<td><input id="text1" readonly /></td>
										</tr>
										<tr>
											<td><strong>身份证号：</strong></td>
											<td><input id="text2" /></td>
										</tr>
										<tr>
											<td><strong>姓名：</strong></td>
											<td><input id="text3" /></td>
										</tr>
										<tr>
											<td><strong>性别:</strong></td>
											<td><input id="text4" /></td>
										</tr>
										<tr>
											<td><strong>出生日期:</strong></td>
											<td><input id="text5" /></td>
										</tr>
										<tr>
											<td><strong>预退休日期:</strong></td>
											<td><input id="text6" /></td>
										</tr>
										<tr>
											<td><strong>实际退休日期:</strong></td>
											<td><input id="text7" /></td>
										</tr>
										<tr>
											<td><strong>特殊工种:</strong></td>
											<td><input id="text8" /></td>
										</tr>
										<tr>
											<td><strong>女管理岗位:</strong></td>
											<td><input id="text9" /></td>
										</tr>
										<tr>
											<td><strong>职称：</strong></td>
											<td><input id="text10" /></td>
										</tr>
										<tr>
											<td><strong>工龄：</strong></td>
											<td><input id="text11" /></td>
										</tr>
									</table>

								</div>
							</div>
						</h3>

					</div>
					<div class="col-md-1 col-md-offset-7">
						<button id="update" class="btn btn-primary btn-block">修改</button>
					</div>
				</div>
			</div>
			<div role="tabpanel" class="tab-pane" id="profile">
			
			</div>
			<div role="tabpanel" class="tab-pane" id="messages">
				
				<form action="" id="form" method="post" enctype="multipart/form-data">
				<input type="file" name="file"/>
			    <input type="submit" name="Submit" value="提交" />
	            </form>
				
			</div>
		</div>
	</div>
	<script id="template" type="text/x-handlebars-template">
   {{#each item}}
  <div class="panel panel-default col-md-3" >
     <div class="panel-body">
       <a href="photo.html?id={{id}}"> <img src="upload/{{archive_id}}/{{name}}" width="200" height="200" /></a>
         
      </div>
    </div>
 {{/each}}
</script>
	 <script type="text/javascript">
  $.backstretch("101.jpg");
  </script>

	<script type="text/javascript">
		$(function() {
			$.getJSON('querynickname.action', function(res) {
				console.log(res);
				$('#nickname').text(res.s3);

			});
			var id = getQueryString('id');
			var url = 'query.action?id=' + id;
			$.getJSON(url, function(res) {
				console.log(res);
				$('#text1').val(res.archive);
				$('#text2').val(res.identity);
				$('#text3').val(res.name);
				$('#text4').val(res.gender);
				$('#text5').val(res.birthday);
				$('#text6').val(res.date_retire1);
				$('#text7').val(res.date_retire2);
				$('#text8').val(res.sp);
				$('#text9').val(res.fc);
				$('#text10').val(res.title);
				$('#text11').val(res.seniority);
			})

		})
		$(function() {
			var id = getQueryString('id');
			$('#update').click(function() {
				$.post('update.action?id=' + id, {
					archive : $('#text1').val(),
					identity : $('#text2').val(),
					name : $('#text3').val(),
					gender : $('#text4').val(),
					birthday : $('#text5').val(),
					date_retire1 : $('#text6').val(),
					date_retire2 : $('#text7').val(),
					sp : $('#text8').val(),
					fc : $('#text9').val(),
					title : $('#text10').val(),
					seniority : $('#text11').val()
				}, function(res, status) {
					if ('OK' == res) {
						alert('修改成功');
					}
				});
			});
			$('#myTabs a').click(function(e) {
				e.preventDefault()
				$(this).tab('show')
			})
			
         
		 });
		 $(function(){
       	  var id = getQueryString('id');
       	  console.log('id: ' + id);
       	  $('#form').attr('action',id+'/upload.action');
       	   console.log(id);
         })
         $(function() {
        	 var id = getQueryString('id');
         $.getJSON('queryword.action?id=' + id, function(res) {
				console.log(res);
				var data = {
					'item' : res};
				var t = Handlebars.compile($('#template').html());
				$('#profile').html(t(data));
				
			});
         });
</script>
</body>

</html>